﻿using System;
using System.Collections;
using System.Collections.Generic;
namespace WPFExcelReport
{
    public class DevelopmentReport : BaseReport
    {
        string strCompany = "HLT";
        string strExcelFile = "";
        public DevelopmentReport()
            : base()
        {
        }
        public DevelopmentReport(Dictionary<string, object> dicParamater)
            : base(dicParamater)
        { 
            strCompany = dicParamater["Company"].ToString().Trim();
            strExcelFile = dicParamater["ExcelFile"].ToString().Trim();
            
           
        }
        private void Yarn_Inventory_COLUMNS()
        {
            columns.Add("CODE"); columns.Add("GLLB"); columns.Add("ART"); columns.Add("VAR"); columns.Add("SUPPLIER");
            columns.Add("BATCH"); columns.Add("SUPPLIERBATCH"); columns.Add("INCOMEDATE"); columns.Add("WEI");
            
        }

        public void Yarn_Inventory_TO_EXCEL(string fileType)
        {  
            Queue CellQueue = new Queue();
            Yarn_Inventory_COLUMNS();
            string filename = "";
            string sheetName = "";
            string Standard = "Technical_Yarn_Stock";
            strExcelFile = @"HLT\HLTSummaryReport.xls";
            string filePath = @"C:\intex.w\Report\" + strExcelFile;
            exAgent.Open(filePath);
            exAgent.Company = "";
            exAgent.strExcelFile = strExcelFile;
            string filedate = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString();
            filename = @"Development\纱线库存表" + filedate + ".xls";
            sheetName = DateTime.Now.ToShortTimeString().Replace(@":","");
            exAgent.CreateNewSheet(filename, Standard, sheetName);
            FillInData(columns, dsSource.Tables["YARN_INVENTORY"]); 
            if (exAgent != null)
            {
                exAgent.Save();
                exAgent.Close();
            }
        }
        private void SalesOrder_Customer_COLUMNS()
        {
            columns.Add("KDKUNDNA"); columns.Add("VKPART"); columns.Add("VKPFARBE"); columns.Add("QUANTITY");
           
        }

        public void SalesOrder_Customer_TO_EXCEL(string fileType)
        {
            Queue CellQueue = new Queue();
            SalesOrder_Customer_COLUMNS();
            string filename = "";
            string sheetName = "";
            string Standard = "Technical_Sales_Summary";
            strExcelFile = @"HLT\HLTSummaryReport.xls";
            string filePath = @"C:\intex.w\Report\" + strExcelFile;
            exAgent.Open(filePath);
            exAgent.Company = "";
            exAgent.strExcelFile = strExcelFile;
            string filedate = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString();
            filename = @"Development\客户订单排名" + filedate + ".xls";
            sheetName = DateTime.Now.ToShortTimeString().Replace(@":", "");
            exAgent.CreateNewSheet(filename, Standard, sheetName);
            FillInData(columns, dsSource.Tables["VKPOS"]);
            if (exAgent != null)
            {
                exAgent.Save();
                exAgent.Close();
            }
        }

        private void SalesOrder_Article_COLUMNS()
        {
            columns.Add("VKPART"); columns.Add("QUANTITY"); 
        }

        public void SalesOrder_Article_TO_EXCEL(string fileType)
         {
             Queue CellQueue = new Queue();
             SalesOrder_Article_COLUMNS();
             string filename = "";
             string sheetName = "";
             string Standard = "Technical_Sales_Artical";
             strExcelFile = @"HLT\HLTSummaryReport.xls";
             string filePath = @"C:\intex.w\Report\" + strExcelFile;
             exAgent.Open(filePath);
             exAgent.Company = "";
             exAgent.strExcelFile = strExcelFile;
             string filedate = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString();
             filename = @"Development\品种订单排名" + filedate + ".xls";
             sheetName = DateTime.Now.ToShortTimeString().Replace(@":", "");
             exAgent.CreateNewSheet(filename, Standard, sheetName);
             FillInData(columns, dsSource.Tables["SalesOrder"]);
             if (exAgent != null)
             {
                 exAgent.Save();
                 exAgent.Close();
             }
         }
        
        private void Sizing_Technology_COLUMNS()
        {
            columns.Add("BBKART"); columns.Add("BBKVAR"); columns.Add("BBKFARBE"); columns.Add("LSLIEFNR"); 
            columns.Add("FACTORY"); columns.Add("LOT"); columns.Add("COMPOSITION"); columns.Add("BSFDZ"); 
            columns.Add("SUPPLIER"); 
        }

        public void Sizing_Technology_TO_EXCEL(string fileType)
         {
             Queue CellQueue = new Queue();
             Sizing_Technology_COLUMNS();
             string filename = "";
             string sheetName = "";
             string Standard = "Technical_Sizing";
             strExcelFile = @"HLT\HLTSummaryReport.xls";
             string filePath = @"C:\intex.w\Report\" + strExcelFile;
             exAgent.Open(filePath);
             exAgent.Company = "";
             exAgent.strExcelFile = strExcelFile;
             string filedate = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString();
             filename = @"Development\浆纱工艺表" + filedate + ".xls";
             sheetName = DateTime.Now.ToShortTimeString().Replace(@":", "");
             exAgent.CreateNewSheet(filename, Standard, sheetName);
             FillInData(columns, dsSource.Tables["SIZING_TECHNOLOGY"]);
             if (exAgent != null)
             {
                 exAgent.Save();
                 exAgent.Close();
             }
         }

        private void Yarn_Dyeing_COLUMNS()
        {
            columns.Add("ABPAUFKRS"); columns.Add("ABPAUFLFD"); columns.Add("ABPAUFPOS"); columns.Add("ABPART");
            columns.Add("ABPVAR"); columns.Add("FACTORY"); columns.Add("COLOR"); columns.Add("ABPFARBE");
            columns.Add("QUANTITY");columns.Add("ABPSTARTDAT");columns.Add("ABPENDDAT");columns.Add("ACTENDDATE");
           
        }

        public void Yarn_Dyeing_TO_EXCEL(string fileType)
        {
            Queue CellQueue = new Queue();
            Yarn_Dyeing_COLUMNS();
            string filename = "";
            string sheetName = "";
            string Standard = "Technical_Yarn";
            strExcelFile = @"HLT\HLTSummaryReport.xls";
            string filePath = @"C:\intex.w\Report\" + strExcelFile;
            exAgent.Open(filePath);
            exAgent.Company = "";
            exAgent.strExcelFile = strExcelFile;
            string filedate = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString();
            filename = @"Development\纱线生产明细表" + filedate + ".xls";
            sheetName = DateTime.Now.ToShortTimeString().Replace(@":", "");
            exAgent.CreateNewSheet(filename, Standard, sheetName);
            FillInData(columns, dsSource.Tables["ABPOS"]);
            if (exAgent != null)
            {
                exAgent.Save();
                exAgent.Close();
            }
        }

        private void Finishing_Order_COLUMNS()
        {
            columns.Add("ABPAUFKRS"); columns.Add("ABPAUFLFD"); columns.Add("ABPAUFPOS"); columns.Add("ABPART");
            columns.Add("ABPVAR"); columns.Add("ABPFARBE"); columns.Add("ABPBESCHICH"); columns.Add("QUANTITY");
            columns.Add("COMPOSITION"); columns.Add("FACTORY"); columns.Add("ABPSTARTDAT"); columns.Add("ISSUEDATE");
            columns.Add("ABPENDDAT"); columns.Add("RECEIVEDATE");  
        }

        public void Finishing_Order_TO_EXCEL(string fileType)
        {
            Queue CellQueue = new Queue();
            Finishing_Order_COLUMNS();
            string filename = "";
            string sheetName = "";
            string Standard = "Technical_Finishing";
            strExcelFile = @"HLT\HLTSummaryReport.xls";
            string filePath = @"C:\intex.w\Report\" + strExcelFile;
            exAgent.Open(filePath);
            exAgent.Company = "";
            exAgent.strExcelFile = strExcelFile;
            string filedate = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString();
            filename = @"Development\后整理订单工艺表" + filedate + ".xls";
            sheetName = DateTime.Now.ToShortTimeString().Replace(@":", "");
            exAgent.CreateNewSheet(filename, Standard, sheetName);
            FillInData(columns, dsSource.Tables["FINISHING_ORDER"]);
            if (exAgent != null)
            {
                exAgent.Save();
                exAgent.Close();
            }
        }
    }
    }


